| Fully Qualified Name: | Laminas\InputFilter\OptionalInputFilter |
| Extends: | InputFilter |
InputFilter which only checks the containing Inputs when non-empty data is set, else it reports valid
This is analog to {@see \Laminas\InputFilter\Input} with the option ->setRequired(false)
| Name | Description | Defined By |
|---|---|---|
| add() | Add an input to the input filter | InputFilter |
| count() | Countable: number of inputs in this input filter | BaseInputFilter |
| get() | Retrieve a named input | BaseInputFilter |
| getFactory() | Get factory to use when adding inputs and filters by spec | InputFilter |
| getInputs() | Get an array of all inputs | BaseInputFilter |
| getInvalidInput() | Return a list of inputs that were invalid. | BaseInputFilter |
| getMessages() | Return a list of validation failure messages | BaseInputFilter |
| getRawValue() | Retrieve a raw (unfiltered) value from a named input | BaseInputFilter |
| getRawValues() | Return a list of unfiltered values | BaseInputFilter |
| getUnfilteredData() | BaseInputFilter | |
| getUnknown() | Return the unknown input | BaseInputFilter |
| getValidInput() | Return a list of inputs that were valid. | BaseInputFilter |
| getValue() | Retrieve a value from a named input | BaseInputFilter |
| getValues() | Return a list of filtered values, or null if the data was missing entirely Null is returned instead of an empty array to prevent it being passed to a hydrator, which would likely cause failures later on in your program Fallbacks for the inputs are not respected by design | OptionalInputFilter |
| has() | Test if an input or input filter by the given name is attached | BaseInputFilter |
| hasUnknown() | Is the data set has unknown input ? | BaseInputFilter |
| init() | This function is automatically called when creating element with factory. It allows to perform various operations (add elements. | BaseInputFilter |
| isValid() | Run validation, or return true if the data was empty | OptionalInputFilter |
| merge() | Merges the inputs from an InputFilter into the current one | BaseInputFilter |
| remove() | Remove a named input | BaseInputFilter |
| replace() | Replace a named input | BaseInputFilter |
| setData() | Set data to use when validating and filtering | OptionalInputFilter |
| setFactory() | Set factory to use when adding inputs and filters by spec | InputFilter |
| setUnfilteredData() | BaseInputFilter | |
| setValidationGroup() | Provide a list of one or more elements indicating the complete set to validate | BaseInputFilter |
Add an input to the input filter
| Parameter Name | Type | Description |
|---|---|---|
| $input | array|\Traversable|\InputInterface|\InputFilterInterface | |
| $name | null|string |
Returns: \InputFilter
Countable: number of inputs in this input filter
Only details the number of direct children.
Returns: int
Retrieve a named input
| Parameter Name | Type | Description |
|---|---|---|
| $name | string |
Returns: \InputInterface|\InputFilterInterface
Get factory to use when adding inputs and filters by spec
Lazy-loads a Factory instance if none attached.
Returns: \Factory
Get an array of all inputs
Returns: \InputInterface[]|\InputFilterInterface[]
Return a list of inputs that were invalid.
Implementations should return an associative array of name/input pairs that failed validation.
Returns: \InputInterface[]
Return a list of validation failure messages
Should return an associative array of named input/message list pairs. Pairs should only be returned for inputs that failed validation.
Returns: array
Retrieve a raw (unfiltered) value from a named input
| Parameter Name | Type | Description |
|---|---|---|
| $name | string |
Returns: mixed
Return a list of unfiltered values
List should be an associative array of named input/value pairs, with the values unfiltered.
Returns: array
Returns: array|object
Return the unknown input
Returns: array
Return a list of inputs that were valid.
Implementations should return an associative array of name/input pairs that passed validation.
Returns: \InputInterface[]
Retrieve a value from a named input
| Parameter Name | Type | Description |
|---|---|---|
| $name | string |
Returns: mixed
Return a list of filtered values, or null if the data was missing entirely Null is returned instead of an empty array to prevent it being passed to a hydrator, which would likely cause failures later on in your program Fallbacks for the inputs are not respected by design
Returns: array|null
Test if an input or input filter by the given name is attached
| Parameter Name | Type | Description |
|---|---|---|
| $name | string |
Returns: bool
Is the data set has unknown input ?
Returns: bool
This function is automatically called when creating element with factory. It allows to perform various operations (add elements.
..)
Returns: void
Run validation, or return true if the data was empty
{@inheritDoc}
| Parameter Name | Type | Description |
|---|---|---|
| $context |
Returns:
Merges the inputs from an InputFilter into the current one
| Parameter Name | Type | Description |
|---|---|---|
| $inputFilter | \BaseInputFilter |
Returns: self
Remove a named input
| Parameter Name | Type | Description |
|---|---|---|
| $name | string |
Returns: \InputFilterInterface
Replace a named input
| Parameter Name | Type | Description |
|---|---|---|
| $input | mixed | Any |
| $name | string | Name |
Returns: self
Set data to use when validating and filtering
| Parameter Name | Type | Description |
|---|---|---|
| $data | iterable|mixed | must |
Returns: \InputFilterInterface
Set factory to use when adding inputs and filters by spec
| Parameter Name | Type | Description |
|---|---|---|
| $factory | \Factory |
Returns: \InputFilter
| Parameter Name | Type | Description |
|---|---|---|
| $data | array|object |
Returns: $this
Provide a list of one or more elements indicating the complete set to validate
When provided, calls to {@link isValid()} will only validate the provided set.
If the initial value is {@link VALIDATE_ALL}, the current validation group, if any, should be cleared.
Implementations should allow passing a single array value, or multiple arguments, each specifying a single input.
| Parameter Name | Type | Description |
|---|---|---|
| $name | mixed |
Returns: \InputFilterInterface